package com.ticket.sass.admin.validator;


import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

import static java.lang.annotation.ElementType.*;

/**
 * 时间校验
 * @author ywb
 * @date 2021-12-01 16:35
 */
@Documented
@Repeatable(InTime.List.class)
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = InTimeValidation.class)
@Target({TYPE, FIELD, METHOD, PARAMETER, ANNOTATION_TYPE, TYPE_USE})
public @interface InTime {

    String beginTime() default "startTime";

    String endTime() default "endTime";

    String message() default "开始时间不能晚于结束时间";

    Class<? extends Payload>[] payload() default {};

    Class<?>[] groups() default {};

    @Target({TYPE, FIELD, METHOD, PARAMETER, ANNOTATION_TYPE})
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @interface List {
        InTime[] value();
    }
}